package com.study.modules.hutoolStudy;

import cn.hutool.core.util.RuntimeUtil;
import cn.hutool.core.util.StrUtil;

/**
 * hutool中的windows工具类测试
 */
public class HutoolCmdUtilTest {

    public static void main(String[] args) throws InterruptedException {
        testWindowsCmd();
    }

    public static void testWindowsCmd() {
        String ipconfigStr = "ipconfig";
        String ipconfig1 = RuntimeUtil.execForStr(ipconfigStr);
        System.out.println(ipconfigStr + "：");
        System.out.println(ipconfig1.replaceFirst("\n", "").replace("\r\n\r\n\r", "").replace("\r\n\r\n", "\r\n")
                .replace("   ", "").replace("  ", "").replace(". ", "."));
        System.out.println("==============================\n");
        String pingCmdStr = "ping 192.168.12.52";
        String pingCmd = RuntimeUtil.execForStr(pingCmdStr);
        System.out.println(pingCmd.replaceFirst("\n", "").replace(" ", "")
                .replace("\r", "").replace("\n\n", "\n"));
    }

}
